/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package homework6;

/**
 *
 * @author Administrator
 */
import java.util.*;
public class MainC2 {
    public static void main(String[] args) {
       Scanner cin=new Scanner(System.in);
        while(cin.hasNext()){
           int y=cin.nextInt();
           int n=cin.nextInt();
           String m;
           int d;
           if((y%4==0&&y%100!=0)||y%400==0){
               if(n<=31){ m="01";d=n;}
               else if(n>31&&n<=60){ m="02";d=n-31;}
               else if(n>60&&n<=91){ m="03";d=n-60;}
               else if(n>91&&n<=121){ m="04";d=n-91;}
               else if(n>121&&n<=152){ m="05";d=n-121;}
               else if(n>152&&n<=182){ m="06";d=n-152;}
               else if(n>182&&n<=213){ m="07";d=n-182;}
               else if(n>213&&n<=244){ m="08";d=n-213;}
               else if(n>244&&n<=274){ m="09";d=n-244;}
               else if(n>274&&n<=305){ m="10";d=n-274;}
               else if(n>305&&n<=335){ m="11";d=n-305;}
               else { m="12";d=n-335;}
          }
           else{
               if(n<=31){ m="01";d=n;}
               else if(n>31&&n<=59){ m="02";d=n-31;}
               else if(n>59&&n<=90){ m="03";d=n-59;}
               else if(n>90&&n<=120){ m="04";d=n-90;}
               else if(n>120&&n<=151){ m="05";d=n-120;}
               else if(n>151&&n<=181){ m="06";d=n-151;}
               else if(n>181&&n<=212){ m="07";d=n-181;}
               else if(n>212&&n<=243){ m="08";d=n-212;}
               else if(n>243&&n<=273){ m="09";d=n-243;}
               else if(n>273&&n<=304){ m="10";d=n-273;}
               else if(n>304&&n<=334){ m="11";d=n-304;}
               else { m="12";d=n-334;}
           }
           if(d<10)
               System.out.println(y+"-"+m+"-0"+d);
           else
               System.out.println(y+"-"+m+"-"+d);
       }
    }
}
